#include <iostream>
using namespace std;

void test()
{
    int a, b, c;
    int q = 0;
    cin >> q;
    while (q)
    {
        int ans = 0;
        cin >> a >> b >> c;
        int Min = min(min(a, b), c);
        ans += 2 * Min;
        if (b - Min > 1) ans += b - Min - 1;
        cout << ans << endl;
        --q;
    }
}

//ooooo
int main() {
    test();
    return 0;
}